/**查看评价审核.js*/

function cancel(){
    var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);
}
function showin(val){
	if(val==1){
		$("#content").val("");
		$("#content").attr("readonly","readonly");
	}else if(val==2){
		$("#content").removeAttr("readonly");
	}
	countLength();
}
//通过审核
function buSubmit(){
	var state = $("input:radio:checked[name='state']").val();
	var confirm_text;
	if(state=='2'){confirm_text="确定通过审核?";}
	else if(state=='3'){confirm_text="确定拒绝通过审核 ?";}
	else {confirm_text="确定进行此操作?";}
	layer.confirm(confirm_text,function(){
		layer.closeAll('dialog');
		var layer_load_window = layer.load(2); 
		$("#update_form").ajaxSubmit({
			dataType : 'html',
            success: function(message){
            		if(message == "200"){
                        layer.msg('审核成功!',{icon:1,time:1000},function(){
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.query_compaints_prosals_form.submit();
                            parent.layer.close(index);
                        });
     				}else if(message == "500"){
     					layer.alert("系统繁忙！");
     				}else{
     					layer.alert(message);
     				}
            },
            error: function(){
                layer.msg('操作失败!',{icon:5,time:1000});
            },complete: function(XMLHttpRequest, textStatus) {
            	layer.close(layer_load_window);
            }
        });	
	});
}
//js去掉空格
function trim(str){
    return  (str+"").replace(/^\s+|\s+$/g,"");
}
//提示文本域可以输入多少
function countLength(){
	var text=document.getElementById("content").value;
	var len=250-text.length;
	var show="您还可以输入<font style='color: red'>"+len+"</font>个字";
	document.getElementById("count").innerHTML=show;
}